package com.iclub.controller;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;

import com.alibaba.fastjson.JSON;
import com.iclub.model.SignUpInfo;
import com.iclub.service.ActiveInfoService;
import com.iclub.service.IClubUserService;
import com.iclub.service.MerchantService;
import com.iclub.service.MessageService;

/**
 * 基础服务类
 */
@Controller
@RequestMapping("/common")
public class BaseController {

	@RequestMapping("/argsError.to")
	public void insertSignupInfo(HttpServletRequest request,
			HttpServletResponse response) throws IOException {
		Map<String, Object> res = new HashMap<String, Object>();
		res.put("retCode", "501");
		res.put("retMsg", "参数输入错误");
		String json = JSON.toJSONString(res);
		response.setCharacterEncoding("utf-8");
		response.getWriter().write(json);

	}

	// 日志级别
	protected Logger log_detail = Logger.getLogger("DETAIL");

	// 对象去空
	protected String trim(Object src) {
		return src == null ? "" : src.toString().trim();
	}

	public static String getPrimaryKey() {
		UUID uuid = UUID.randomUUID();
		return uuid.toString().replace("-", "");
	}

	@Autowired
	protected ActiveInfoService activeInfoServiceImpl;

	@Autowired
	protected IClubUserService iClubUserServiceImpl;

	@Autowired
	protected MerchantService merchantServiceImpl;

	@Autowired
	protected MessageService messageServiceImpl;

}
